package com.glsc.ngateway.common.base.domain.mysql.gateway.other;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Set;

@ToString
@Data
@Entity
@Table(name = "t_am_system_license_expire")
public class SystemLicenseExpire implements Serializable {

    private static final long serialVersionUID = -2504338726893322494L;

    @ApiModelProperty(value = "系统ID")
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "system_id")
    protected Integer systemId;

    @ApiModelProperty(value = "系统名称")
    @Column(name = "system_name", columnDefinition = "varchar(100) COMMENT '系统名称'")
    protected String systemName;

    @ApiModelProperty(value = "系统管理员邮箱，逗号分隔")
    @Column(name = "admin_email", columnDefinition = "varchar(1000) COMMENT '系统管理员邮箱，逗号分隔'")
    protected String adminEmail;

    @ApiModelProperty(value = "系统License到期日")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @Column(name = "system_license_expire", columnDefinition = "varchar(10) COMMENT '系统License到期日 yyyy-MM-dd'")
    protected String systemLicenseExpire;

    @ApiModelProperty(value = "提前通知天数")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @Column(name = "before_remind_days", columnDefinition = "int COMMENT '提前通知天数'")
    protected Integer beforeRemindDays;

    @ApiModelProperty(value = "子模块")
    @OneToMany(cascade = {CascadeType.ALL},orphanRemoval=true,fetch = FetchType.EAGER)
    @JoinColumn(name = "system_id", referencedColumnName = "system_id",foreignKey = @ForeignKey(name = "none",value = ConstraintMode.NO_CONSTRAINT))
    protected Set<SystemLicenseModule> moduleSet;

}
